<{include file="public_html/header.html"}>
<{include file="public_html/left_menu.html"}>

<blockquote class="layui-elem-quote"><{$action}></blockquote>

<form class="layui-form layui-form-" method="post" action="<{$post_url}>" id="form_add_role">
	<div class="layui-form-item">
		<label class="layui-form-label">上级分类</label>
		<div class="layui-input-inline" style="padding-top: 8px;">
			
			<input type="hidden" name="pid" id="pid" value="<{$subject['pid']|default:'0'}>" />
			<span id="parent"><{$parent_subject}></span>

			<a href="javascript:;" class="layui-this" style="color: #3ac9af" onclick="choice_accounts(this)">选择上级分类</a>
		</div>
	</div>

	<input type="hidden" name="id" value="<{$subject['id']|default:'0'}>" />
	<div class="layui-form-item">
		<label class="layui-form-label">分类名称</label>
		<div class="layui-input-inline">
			<input type="text" name="title" value="<{$subject.title|default:''}>" required lay-verify="required" autocomplete="off" class="layui-input">
		</div>
	</div>

	

	<div class="layui-form-item">
		<label class="layui-form-label">排序</label>
			<div class="layui-input-inline">
				<input type="text" name="sort" value="<{$subject.sort|default:'0'}>" autocomplete="off" class="layui-input">
			</div>
	</div>

	<div class="layui-form-item">
	    <label class="layui-form-label">是否启用</label>
	    <div class="layui-input-inline">
	            <{assign var="status" value=$subject.status|default:"1"}>
	            <input type="checkbox" <{if $status == 1}> checked <{/if}> name="status" lay-skin="switch" lay-filter="switchTest" value="1" >
	    </div>
  	</div>

	<div class="layui-form-item layui-form-text">
		<label class="layui-form-label">分类简介</label>
		<div class="layui-input-inline">
			<textarea name="remark" style="width: 300px;" class="layui-textarea"><{$subject.remark|default:""}></textarea>
		</div>
	</div>

	<div class="layui-input-block">
		<button class="layui-btn" lay-submit lay-filter="*">保存</button>
		<button type="reset" class="layui-btn layui-btn-primary">重置</button>
	</div>
</form>


<{include file="public_html/footer.html"}>

<script >
	
		function choice_accounts(obj){
		$(".accounts").attr("id", "");
		$(".accounts").siblings().attr("id", "");
		$(obj).siblings(".accounts").attr("id", "hidden_id");
		$(obj).attr("id", "hidden_id_text");
		layer.open({
			type: 2,
			title: '选择科目',
			shadeClose: true,
			shade: 0.8,
			area: ['20%', '70%'],
			maxmin: true,
			content: '/tk_accounts_subject/iframe_list2' //iframe的url
		}); 
	}

	function select_radio(id){
		$("#pid").val(id);
		// alert(id);
		$.get('/tk_accounts_subject/get_name_by_id/'+id,function(res){
			// alert(res);
			$("#parent").text(res);
		})
		
	}
</script>>
